/**
 * Bookshelf路由模块
 */

var express = require('express');
var router = express.Router();

const bookshelf = require("../controller/bookshelf");
const auth = require("../controller/auth");

// 定义路由
// 守卫路由：所有路由必须执行权限控制的判断
router.all("*", auth.isLogin);

router.patch("/read-status/:id", bookshelf.updateReadStatus);

router.patch("/ranking/:id", bookshelf.updateRanking);

router.get("/count",bookshelf.getCount)

router.get("/:id", bookshelf.find);

router.get("/", bookshelf.findAll);

router.post("/", bookshelf.add);

router.put("/:id", bookshelf.update);

router.delete("/:id", bookshelf.remove);

module.exports = router;